import Cookies from 'js-cookie'

const TokenKey = 'sunlead-logistics-token' // 设定一个独一无二的key
const UserKey = 'USER_INFO'
const MenuKey = 'MENU_LIST'

export function getToken () {
  return Cookies.get(TokenKey)
}

export function setToken (token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken () {
  return Cookies.remove(TokenKey)
}
export function getUserInfo () {
  return JSON.parse(localStorage.getItem(UserKey))
}
export function setUserInfo (userInfo) {
  localStorage.setItem(UserKey, JSON.stringify(userInfo))
}
export function delUserInfo () {
  localStorage.removeItem(UserKey)
}
export function getMenuList () {
  return JSON.parse(localStorage.getItem(MenuKey))
}
export function setMenuList (menuList) {
  localStorage.setItem(MenuKey, JSON.stringify(menuList))
}
export function delMenuList () {
  localStorage.removeItem(MenuKey)
}
